<template>
  <div>
    <template v-if="$app.judgeData(orderInfo) && $app.judgeData(orLiInfo)">
      <Card class="marginB10">
        <!-- aTopType 1专利 2商标 3版权 -->
        <ATopBase :orderInfo="orderInfo" :orLiInfo="orLiInfo" :aTopType="2" />

        <div class="overflowH" style="padding:0 40px;">
          <!-- 0已经取消，9商标局不予受理，14驳回 -->
          <template v-if="orderInfo.state==0||orderInfo.state==9||orderInfo.state==14">
            <Steps :current="stateIng" class="marginB20">
              <Step title="创建订单"></Step>
              <Step :title="orderInfo.state_name"></Step>
            </Steps>
          </template>
          <template v-else>
            <Steps :current="stateIng" class="marginB20">
              <Step title="创建订单"></Step>
              <Step title="已付款"></Step>
              <Step title="资料审核中"></Step>
              <Step title="已递交商标局"></Step>
              <Step title="注册成功"></Step>
            </Steps>
          </template>

          <OdUl :list="orderInfo.state_log" />
        </div>

        <div class="clearBoth " :class="(orderInfo.state==0 || orderInfo.state==1|| orderInfo.state==2)?' padding5 ' :' '"></div>

        <!-- 0已取消,1未付款,2已付款，规则如下：0或1可以删除订单，1或2可以修改订单，1未支付，可以支付 -->
        <template v-if="orderInfo.state==0||orderInfo.state==1">
          <Button type="default" class="marginR10" @click="$app.delOrderOk(orLiInfo.id)">
            <Icon type="ios-trash" size="18" class="cCCC relative marginR5" />删 除
          </Button>
        </template>
        <template v-if="orderInfo.state==1||orderInfo.state==2">
          <Button type="primary" ghost class="marginR10" @click="ttW">
            <Icon type="ios-create-outline" size="18" class="relative marginR5" />修改订单
          </Button>
        </template>
        <!-- 未付款 -->
        <template v-if="orderInfo.state==1">
          <Button type="primary" class="marginR30" @click="zFu">
            <Icon type="logo-yen" size="14" class="relative marginR5" />付 款
          </Button>
        </template>
      </Card>

      <template v-if="(orderInfo.state==10)">
        <Card class="marginB10">
          <span class="lineH34 c333 f_16 f_bold marginR20 relative">系统预警</span>
          <Button
            type="primary"
            class="marginR30 relative"
            style="top:-2px;"
            @click="ttW"
          >
            <Icon type="md-create" size="14" class="relative marginR5" />修改订单
          </Button>
          <template v-if="$app.package_file_url(orderInfo.ignore_note_path)">
            请下载：
            <span
              class="marginR30 underline f_16 textLink cBlue"
              @click="$app.fileNameAgainDown($app.getVal_fileUrl(orderInfo.ignore_note_path),orderInfo,orLiInfo);"
            >不予受理通知书</span>
          </template>

          <template v-if="$app.judgeData(orderInfo.ignore_time)">
            <span class="f_14 marginR30">通知日期：{{orderInfo.ignore_time}}</span>
          </template>
          
        </Card>
      </template>

      <!-- 已下单未付款 -->
      <template v-if="orderInfo.state==1">
        <!-- 下单成功支付框 -->
        <PayBox ref="payBox" :noOrderList="true" />
      </template>
    </template>
  </div>
</template>



<script>
import PayBox from "@$@/_service/payBox";
import OdUl from "../common/plugin/odUl";

// 基础订单数据-当前进度
import ATopBase from "@$@/_orderInfo/aTop/aTopBase";
export default {
  name: "aTop",
  components: { PayBox, OdUl, ATopBase },
  props: ["orderInfo", "orLiInfo"],
  data() {
    let data = {
      stateIng: 0 //当前进度
    };
    let tool = {};
    return Object.assign(data, tool);
  },
  watch: {
    orderInfo(newVal, oldVal) {
      let { state } = newVal;
      switch (parseInt(state)) {
        case 0: //状态0和9单独判断
          this.stateIng = 1;
          break;
        case 1:
          this.stateIng = 0;
          break;
        case 2:
          this.stateIng = 1;
          break;
        case 3:
          this.stateIng = 2;
          break;
        case 4:
        case 5:
        case 6:
        case 7:
        case 8:
          this.stateIng = 3;
          break;
        case 9: //状态0和9单独判断
          this.stateIng = 1;
          break;
        case 10:
        case 11:
        case 12:
          this.stateIng = 3;
          break;
        case 13:
          this.stateIng = 4;
          break;
      }
    }
  },
  mounted() {},
  methods: {
    ttW() {
      $app.goEdit(this); //跳转编辑
    },
    zFu() {
      let {
        $route: {
          query: { order_id }
        },
        orderInfo: { state }
      } = this;
      $app.payBoxShow(this, order_id, {
        payFun: () => {
          this.$parent.getData(); //调用父亲初始化数据方法
        }
      });
    }
  }
};
</script>

